<?php 
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, "http://localhost/preg/4.php");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER,0);

//启用post
curl_setopt($ch,CURLOPT_POST,1);
$post_data = array('username'=>'bob','key'=>'12345');
//发送post数据
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_data);

//执行并获取返回内容
$output = curl_exec($ch);

curl_close($ch);

print_r($out);